package leetcode_core.test;
public class Hungry {
    private byte[] data1 = new byte[1024*1024];
    private byte[] data2 = new byte[1024*1024];
    private byte[] data3 = new byte[1024*1024];
    private byte[] data4 = new byte[1024*1024];

    private Hungry(){//注意构造器私有
        if(HUNGRY!=null){
            throw new RuntimeException("请不要尝试通过反射来破坏我的单例!");
        }
    }
    private final static Hungry HUNGRY = new Hungry();//一旦类被加载，就生成该单例对象

    public static Hungry getInstance(){//提供对外访问的方法
        return HUNGRY;
    }
}
